<template>
  <div>
    <NavCustom title="订单页" />
    <!-- <van-contact-card type="add" @click="onAdd" /> -->
    <van-contact-card
      :type="address.choosenAddress ? 'edit' : 'add'"
      :tel="address.choosenAddress?.tel"
      :name="address.choosenAddress?.name"
      @click="onAdd"
    />
    <van-card
      v-for="item in cartCheckList"
      :key="item.objectId"
      :num="item.num"
      :price="item.originprice"
      :title="item.proname"
      :thumb="item.img1"
    />
  </div>
</template>

<script setup lang="ts">
import NavCustom from "../components/nav-custom.vue";
import { ICartType, useCart } from "../store/cart";
import { computed } from "vue";
import { useRouter } from "vue-router";
import { useAddress } from "../store/address";
const router = useRouter();
const onAdd = () => {
  router.push("/address/list");
};
const cart = useCart();
const cartCheckList = computed<Array<ICartType>>(() => {
  return cart.list.filter((item) => {
    return item.ischeck;
  });
});

const address = useAddress();
</script>

<style scoped></style>
